﻿/*********************************************************************************
 *Author:         OnClick
 *Version:        1.0
 *UnityVersion:   2018.3.11f1
 *Date:           2019-04-07
 *Description:    IFramework
 *History:        2018.11--
*********************************************************************************/
namespace IFramework
{
    public class ABBundleAsset : ABAsset
    {
        protected ABBundle bundle;
        internal ABBundleAsset(string path, System.Type type) : base(path, type) { }
        public override void OnLoad()
        {
            bundle = ABBundles.LoadSync(ABAssets.Instance.GetBundleName(AssetPath));
            Asset = bundle.LoadAsset(ABAssets.Instance.GetAssetName(AssetPath), AssetType);
        }
        public override void OnUnLoad()
        {
            if (bundle != null) bundle.Release();
            bundle = null;
        }

    }
}
